<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var hero = {
            name: "李白",
            skill: "青莲剑歌",
            say:function(){
                console.log('我是李白，李太白')
            },
            key:'haha'
            
        }
        hero.name //
        hero.name = "李太白"
        hero.say()
        hero['name'] // 
        var key = "name"
        console.log(hero[key])
        console.log(hero.key)
        //增加属性
        hero.hp = 200
        hero.attack = function(name){
            console.log(`a了${name}一下`)
        }
        //修改属性/方法
        hero.hp = 100
        //置为空
        hero.key = null
        //删除
        delete hero.key
        //查询，判断对象是否存在这个键
        const isName = 'name1' in hero
        //对象的遍历
        var ys = {
            name:'亚索',
            alias:'快乐风男',
            hp:200,
            gjl:100
        }
        //for -in 遍历对象的键，遍历数组的下标，
        for(let key in ys){
            console.log(key)
            console.log(ys[key])
        }
        var arr = [2,3,4,5,6]
    </script>
</body>

</html>